package pojo;

import java.util.HashMap;
import java.util.Map;

/**
 * @author HZY
 */
public class User {
    private int id;
    private String telephone;
    private String Email;
    private String username;

    /**
     * 多种构造方法
     */
    public User() {
    }

    public User(int id) {
        this.id = id;
    }

    public User(String TorE, String username, boolean flag) {
        if (flag) {
            this.telephone = TorE;
        } else {
            this.Email = TorE;
        }
        this.username = username;
    }

    public User(String telephone, String email, String username) {
        this.telephone = telephone;
        Email = email;
        this.username = username;
    }
    /**
     * 转为Map
     */
    public Map<String, String> getMap() {
        return Map.of(
                "id", "" + id,
                "telephone", telephone,
                "Email", Email,
                "username", username
        );
    }

    public Map<String, String> getMap(String password) {
        Map<String, String> map=new HashMap();
        map.put("telephone", telephone);
        map.put("Email", Email);
        map.put("username", username);
        map.put("password",password);
        return map;
    }

    /**
     * 属性的get/set方法
     */
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    public String getEmail() {
        return Email;
    }

    public void setEmail(String email) {
        Email = email;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

}